<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="Specials.SpecialsDeal"%>
<%@page import="java.util.*" %>
<%@ page import="java.sql.*"%>

<%

//需要先实例化对象
SpecialsDeal Specials=new SpecialsDeal();
Specials.setAppID(Specials.CalAppID());


String  SellerID=(String)session.getAttribute("user");
Specials.setSellerID(SellerID);
Specials.setAppTime(Specials.SpTime);
Specials.setComID(request.getParameter("ComID"));
Specials.setAppInf(request.getParameter("AppInf"));
float k=0;
try{
	k=(float)Double.parseDouble(request.getParameter("DisCount"));
}catch(Exception e)
{
	e.printStackTrace();
}
Specials.setDisCount(k);
ResultSet rs=Specials.CalGridCommodity(Specials.getComID());
if(rs.next())
{
	Specials.setComName(rs.getString(2));
	Specials.setComPrice(rs.getFloat(10));
}
Specials.setAppIsChecked(0);
%>

<html>
  <head>
    <title>添加管理员信息</title>
  </head>
  <body>
  <%
    if(Specials.IsHas(Specials.getSellerID(),Specials.getComID())==0)
    {
    	 out.print("<script>alert('用户与商品不匹配 ')</script>");
    }
    else
    {
    	 if(Specials.AddSpecials(Specials.getAppID(),Specials.getSellerID(),Specials.getAppTime(),Specials.getComID(),Specials.getComName(),Specials.getComPrice(),Specials.getDisCount(),Specials.getAppInf(),Specials.getAppIsChecked())==0)
    	 {
    	    
    		   out.print("<script>alert('提交申请失败 ，请重新尝试  ')</script>");
    	 }
    	 else
    	 {
    		   out.print("<script>alert('成功提交申请')</script>");
    		   
    	 }
    }
   
   %>
  	 <script type="text/javascript">

        window.location.href="Specials.jsp";    

   </script>
  </body>
</html>
